// pages/offer/query.js
const app = getApp();
const network = require("../../utils/network.js");
const util = require("../../utils/util.js");
Page({

    /**
     * 页面的初始数据
     */
    data: {
        offerData: [],
        industryList: []
    },

    onLoad() {
        this.getIndustryList()
    },

    getIndustryList() {
        util.showLoading('加载中')
        const _this = this
        network.GET({
            uri: app.api.industryList,
            success(res) {
                _this.setData({
                    industryList: res.data
                })
                util.hideLoading()
            },
            fail() {
                util.hideLoading()
            }
        })
    },

    confirmIndustry({detail}) {
        const _this = this
        util.showLoading('查询中')
        network.GET({
            uri: app.api.offerQuery,
            params: {
                industry_id: detail.value.id
            },
            success(res) {
                _this.setData({
                    offerData: res.data
                })
                util.hideLoading()
            },
            fail() {
                util.hideLoading()
            }
        })
    }

})
